﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LS_ViolationModeWebForm.aspx.cs" Inherits="Anke.SHManage.Web.Reports.LS_ViolationModeWebForm" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>违章管理流水表</title>
    <script src="../Content/EasyUI/jquery.js"></script>
    <script src="../Content/EasyUI/jquery.easyui.js"></script>
    <script src="../Content/EasyUI/locale/easyui-lang-zh_CN.js"></script>
    <link href="../Content/EasyUI/themes/icon.css" rel="stylesheet" />
    <link href="../Content/EasyUI/themes/default/easyui.css" rel="stylesheet" />
    <script src="../Scripts/jquery.AnkeExtend.js"></script>
    <script type="text/javascript">
        //页面加载
        $(document).ready(function () {

            DisableBackspace();
            fillCombobox();

        });
        //#region 为Combobox增加--请选择--
        function EUIcombobox(jqS, o) {
            $.ajax({
                type: "POST",
                async: false,
                url: o.url,
                dataType: "JSON",
                success: function (data1, textStatus, jqXHR) {
                    o.data = o.OneOption.concat(data1);
                    delete o.url;
                    delete o.OneOption;
                    $(jqS).combobox(o);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert("获取字典数据失败！可能是已经超时，请重新登录！");
                }
            });
        }
        function fillCombobox() {
            EUIcombobox("#centerID", {
                url: "../Medical/GetCenter/",
                valueField: 'ID',
                textField: 'Name',
                //prompt: '--请选择--',
                editable: false,
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }],
                onSelect: function (rec) {
                    var urlstation = "../Medical/GetStation?code=" + rec.ID;
                    EUIcombobox("#stationID", {
                        url: urlstation,
                        valueField: 'ID',
                        textField: 'Name',
                        //prompt: '--请选择--',
                        editable: false,
                        OneOption: [{
                            ID: "",
                            Name: "--请选择--"
                        }]
                    });
                }
            });
            //#endregion

            //#region 出车分站
            EUIcombobox("#stationID", {
                url: "../Medical/GetStation?code=",
                valueField: 'ID',
                textField: 'Name',
                //prompt: '--请选择--',
                editable: false,
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }],
                onSelect: function (rec) {
                    var zz = "../CM/CarBasicInfo/getPlateByStationID?stationCode=" + rec.ID;
                    EUIcombobox("#actualCode", {
                        url: zz,
                        valueField: 'AmbulanceCode',
                        textField: 'PlateNumber',
                        editable: false,
                        OneOption: [{
                            AmbulanceCode: "",
                            PlateNumber: "--请选择--"
                        }]
                    });
                    var zzz = "../CM/CarBasicInfo/getPlateByStationID?stationCode=" + rec.ID;
                    EUIcombobox("#ambulanceNumber", {
                        url: zzz,
                        valueField: 'AmbulanceCode',
                        textField: 'CarNumber',
                        editable: false,
                        OneOption: [{
                            AmbulanceCode: "",
                            CarNumber: "--请选择--"
                        }]
                    });
                },
                onChange: function (newValue, oldValue) {
                    $("#ambulanceNumber").combobox('clear');
                    $("#actualCode").combobox('clear');
                }
            });

            //车辆牌号 初始化
            EUIcombobox("#actualCode", {
                url: "../CM/CarBasicInfo/getPlateByStationID?stationCode=",
                valueField: 'AmbulanceCode',
                textField: 'PlateNumber',
                editable: true,
                OneOption: [{
                    AmbulanceCode: "",
                    PlateNumber: "--请选择--"
                }],
                onSelect: function (rec) {

                    $("#ambulanceNumber").combobox('setValue', rec.AmbulanceCode);  //根据选择车牌对应的ID ，给车辆编号赋值
                }
            });
            EUIcombobox("#ambulanceNumber", {       //选择车辆编号的联动 初始化
                url: "../CM/CarBasicInfo/getCarNumberByID?ID=",
                valueField: 'AmbulanceCode',
                textField: 'CarNumber',
                editable: true,
                OneOption: [{
                    AmbulanceCode: "",
                    CarNumber: "--请选择--"
                }],
                onSelect: function (rec) {

                    $("#actualCode").combobox('setValue', rec.AmbulanceCode);  //根据选择车辆编号对应的ID，给车牌号赋值 初始化
                }
            })
            //司机工号和姓名联动
            $.EUIcombobox('#DriverWorkID', {
                // prompt: '--请选择--',
                url: "../CM/CardInfo/GetDriverWorkID",//ajax后台取数据路径，返回的是json格式的数据
                valueField: 'ID',
                textField: 'Name',
                method: 'POST',
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }],
                onSelect: function (rec) {
                    $.ajax({
                        type: 'POST',
                        url: "../CM/CardInfo/GetListByWorkID",
                        data:
                            {
                                workID: rec.Name
                            },
                        dataType: "json",
                        success: function (jsData) {
                            $('#DriverName').combobox("setText", jsData.model.DriverName);
                        }
                    });
                },
                onChange: function () {
                    $('#DriverName').combobox('clear');
                }
            });
            ////取司机工号
            //$.EUIcombobox("#DriverWorkID", {
            //    url: "../CM/CardInfo/GetDriverWorkID/",
            //    valueField: 'ID',
            //    textField: 'Name',
            //    editable: true,
            //    OneOption: [{
            //        ID: "",
            //        Name: "--请选择--"
            //    }]
            //});
            //取司机姓名
            $.EUIcombobox("#DriverName", {
                url: "../CM/CardInfo/GetDriverNames/",
                valueField: 'ID',
                textField: 'Name',
                editable: true,
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }]
            });
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div>
            <table>
                <tr>
                    <td style="width: 8%; text-align: right">违章日期：</td>
                    <td style="width: 12%">
                        <asp:TextBox ID="StartDate" class="easyui-datebox" Style="width: 150px" runat="server" editable="false"></asp:TextBox>
                    </td>
                    <td style="width: 8%; text-align: right">至：</td>
                    <td style="width: 12%">
                        <asp:TextBox ID="EndDate" class="easyui-datebox" Style="width: 150px" runat="server" editable="false"></asp:TextBox>
                    </td>                
                    <td style="width: 8%; text-align: right">司机工号：</td>
                    <td style="width: 12%">
                        <asp:TextBox ID="DriverWorkID" class="easyui-combobox" Style="width: 150px" runat="server"></asp:TextBox>
                    </td>
                    <td style="width: 8%; text-align: right">司机姓名：</td>
                    <td style="width: 12%">
                        <asp:TextBox ID="DriverName" class="easyui-combobox" Style="width: 150px" runat="server"></asp:TextBox>
                    </td>
                    <td style="width: 8%; text-align: right">违章地点：</td>
                    <td style="width: 12%">
                        <asp:TextBox ID="Place" class="easyui-textbox" Style="width: 150px" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                     <td style="width: 8%; text-align: right">分中心：</td>
                    <td style="width: 12%">
                        <asp:TextBox ID="centerID" class="easyui-combobox" Style="width: 150px" runat="server"></asp:TextBox>
                    </td>
                    <td style="width: 8%; text-align: right">分站：</td>
                    <td style="width: 12%">
                        <asp:TextBox ID="stationID" class="easyui-combobox" Style="width: 150px" runat="server"></asp:TextBox>
                    </td>
                    <td style="width: 8%; text-align: right">车牌号码：</td>
                    <td style="width: 12%">
                        <asp:TextBox ID="actualCode" class="easyui-combobox" Style="width: 150px" runat="server"></asp:TextBox>
                    </td>
                    <td style="width: 8%; text-align: right">车辆编号：</td>
                    <td style="width: 12%">
                        <asp:TextBox ID="ambulanceNumber" class="easyui-combobox" Style="width: 150px" runat="server"></asp:TextBox>
                    </td>                                      
                    <td></td>
                    <td></td>
                    <td>
                        <asp:Button ID="Button1" runat="server" Text="查询" OnClick="btnSearch_Click" />
                    </td>
                </tr>
            </table>
            <div style="background-color: #fafafa; border-left: 1px solid scrollbar; overflow: hidden; height: 100%;">

                <rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="100%" Height="100%"   SizeToReportContent="True">
                </rsweb:ReportViewer>
            </div>
        </div>
    </form>
</body>
</html>
